/*
*  Copyright 2019-2020 Liu
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package com.liu.modules.business.domain;

import lombok.Data;
import cn.hutool.core.bean.BeanUtil;
import io.swagger.annotations.ApiModelProperty;
import cn.hutool.core.bean.copier.CopyOptions;
import org.hibernate.annotations.CreationTimestamp;
import org.hibernate.annotations.UpdateTimestamp;

import javax.persistence.*;
import javax.validation.constraints.*;
import java.sql.Timestamp;
import java.io.Serializable;

/**
* @website https://el-admin.vip
* @description /
* @author Liu
* @date 2022-07-04
**/
@Entity
@Data
@Table(name="novel_detail_info")
public class NovelDetailInfo implements Serializable {

    @Id
    @Column(name = "id")
    @ApiModelProperty(value = "第几章和章节名称形成的MD5")
    private String id;

    @Column(name = "novel_id")
    @ApiModelProperty(value = "novel_info表的主键")
    private String novelId;

    @Column(name = "chapter_title")
    @ApiModelProperty(value = "章节标题")
    private String chapterTitle;

    @Column(name = "chapter_index")
    @ApiModelProperty(value = "章节索引")
    private String chapterIndex;

    @Column(name = "chapter_text")
    @ApiModelProperty(value = "章节内容")
    private String chapterText;

    @Column(name = "create_time")
    @ApiModelProperty(value = "创建时间")
    @CreationTimestamp
    private Timestamp createTime;

    @Column(name = "update_time")
    @ApiModelProperty(value = "更新时间")
    @UpdateTimestamp
    private Timestamp updateTime;

    @Column(name = "chapter_url")
    @ApiModelProperty(value = "章节内容url")
    private String chapterUrl;


    public void copy(NovelDetailInfo source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}